import { TODO_DEL } from "../constans/todo"

const initState = [
  {
    id: 1,
    name: '吃饭',
    done: true,
  },
  {
    id: 2,
    name: '睡觉',
    done: false,
  },
]

export default function todo (state = initState, action) {
  switch (action.type) {
    case TODO_DEL:
      return state.filter((item) => item.id !== action.id)
    default:
      return state
  }

}